/*
 * 一个公共模块可以被所有的模块调用
 */
define(function(require, exports, module) {
	var $loading = $('#tool_main_loading');
	var common = {
		loading: {
			open: function() {
				$loading.show();
			},
			close: function() {
				$loading.hide();
			}
		},
		hint: {
			success: function(hint) {
				$("body").append("<div  id='add_success_hint'  style='position: fixed; background: #2F9833; z-index: 100; left: 0px; top: 0px; border-radius: 10px; line-height: 30px; padding-left: 10px; padding-right: 10px; color: #FFFFFF; opacity: 0;'>" + hint + "</div>");
				var add_success_hint = $("#add_success_hint");
				var height = add_success_hint.height;
				var width = add_success_hint.width;
				add_success_hint.css('left', '50%');
				add_success_hint.css('top', '100px');
				add_success_hint.css('margin-left', (width / 2) * -1);
				add_success_hint.transition({
					opacity: 1,
					duration: 300,
					easing: 'ease-in-out',
					complete: function() {
						$(this).transition({
							opacity: 0,
							duration: 5000,
							easing: 'ease-in-out',
							complete: function() {
								$(this).remove();
							}
						});
					}
				});
			},
			error: function(hint) {
				$("body").append("<div  id='add_success_hint'  style='position: fixed; background:red ; z-index: 100; left: 0px; top: 0px; border-radius: 10px; line-height: 30px; padding-left: 10px; padding-right: 10px; color: #FFFFFF; opacity: 0;'>" + hint + "</div>");
				var add_success_hint = $("#add_success_hint");
				var height = add_success_hint.height;
				var width = add_success_hint.width;
				add_success_hint.css('left', '50%');
				add_success_hint.css('top', '100px');
				add_success_hint.css('margin-left', (width / 2) * -1);
				add_success_hint.transition({
					opacity: 1,
					duration: 300,
					easing: 'ease-in-out',
					complete: function() {
						$(this).transition({
							opacity: 0,
							duration: 4000,
							easing: 'ease-in-out',
							complete: function() {
								$(this).remove();
							}
						});
					}
				});
			}
		}
	}
	window.yun_common = common;
});